﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class MyMathf
{
    /// <summary>
    /// 概率计算
    /// </summary>
    public static bool Chance(int percent)
    {
        return (UnityEngine.Random.Range(0, 100) <= percent);
    }

    /// <summary>
    /// x为当前值，在A B 之间   转为在C D 之间的数值
    /// </summary>
    public static float Remap(float x, float A, float B, float C, float D)
    {
        float remappedValue = C + (x - A) / (B - A) * (D - C);
        return remappedValue;
    }
}
